Image file processing method

ABSTRACT

An processing method is used for processing an image file of an image, in which the image is divided into a plurality of image blocks, and at least one row of the minimum coded units sequentially define the image as a plurality of bands. The processing method includes the following steps. An image file of an image is supplied, in which the image file includes a bit stream and exchangeable image file (EXIF) data. A band indicator of the EXIF data is read according to an expanded range. A segment in the bit stream corresponding to a band encompassed by the expanded range is decoded according to the read band indicator corresponding to the band of the expanded range, so as to obtain the band.

CROSS-REFERENCE TO RELATED APPLICATIONS

This non-provisional application claims priority under 35 U.S.C. §119(a)on Patent Application No. 099112071 filed in Taiwan, R.O.C. on Apr. 16,2010, the entire contents of which are hereby incorporated by reference.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The present invention relates to an image file processing method, andmore particularly to a method for decoding a portion of an image file.

2. Related Art

A digital camera captures an image by using an optical sensor, convertsthe image into a digital signal, and then stores the captured image asan image file in a digital file format. Currently, Joint PhotographicExperts Group (JPEG) is one of the most commonly used image fileformats, and image files in JPEG format have been used in most digitalcameras and other digital photograph products.

After the image is captured, a user usually reviews the image filestored in the digital camera. However, no matter how high the resolutionof the image in the digital camera is, the user can only view a reducedresolution image through a small-size display screen. Therefore, whenthe user intends to view a portion of range in the image in detail, theuser may zoom in the image, so as to view details of the portion of theimage.

However, even if it only needs to zoom in and present a portion of therange in the image to the user, the most direct processing method is todecode the entire image file back into a full resolution image, and thendisplay the portion of the image designated by the user. This methodrequires provision of a memory capable of accommodating the fullresolution image, resulting in large consumption of memory capacity,memory bandwidth accessing, and operation resource during imagedecoding. When the image resolution increases rapidly, it results in anincreased burden of decoding.

In order to reduce the required memory capacity, it is considered thatonly a portion of the range in the image is decoded and displayed to theuser. For relevant technologies, reference may be made to, for example,U.S. Pat. No. 7,480,418. As compared with the original file, theconventional method increases the size of the image file due tooverhead, and affects the data compression ratio. Moreover, theprocessed image file needs more information than general imagecompression standard. It is not applicable to existing general decoders(for example, JPEG decoders), so that the compatibility is lost.

Therefore, a heretofore unaddressed need exists in the art to addressthe aforementioned deficiencies and inadequacies.

SUMMARY OF THE INVENTION

The present invention relates to an image file processing method, whichcan solve the problem in the prior art. For example, it requires largeconsumption of memory capacity, memory bandwidth accessing, andoperation resource during decoding only a portion of range in an image.Besides, the prior art has an excessive overhead, and/or cannot beapplied to existing decoders.

The image file processing method of the present invention is used fordecoding a portion of the range in an image according to an expandedrange, so as to display a portion of the image selected by the expandedrange.

Firstly, an image file of the image is provided. The image is dividedinto a plurality of image blocks, and at least one row of the minimumcoded unit (MCU) sequentially define as a band. The image file comprisesa bit stream and exchangeable image file (EXIF) data. The image fileformat may be a JPEG format.

The bit stream may use Huffman coding scheme to represent the image. Thebit stream has a plurality of segments individually corresponding to thebands of the image, and a plurality of restart markers (RSTm or RM)respectively located after the segments except the last segment. Valuesof the RMs may be 0xFFD0 to 0xFFD7 sequentially. Each segment has anon-differential DC coefficient, and the non-differential DC coefficientis corresponding to the first image block of the band.

The EXIF data comprises a plurality of band indicators. The bandindicators are individually corresponding to the bands, and each bandindicator is used for indicating a position of the segment correspondingto the corresponding band in the bit stream. In addition, the EXIF datamay further comprise at least one capturing parameter when the image iscaptured. The capturing parameter may be a camera model, a focal length,an image capturing day and time, an exposure time, an f-number, aphotosensitivity, or a metering mode.

Then, the image file processing method comprises the following steps. Atleast one band indicator is read according to an expanded range forselecting local blocks of the image. At least one segment in the bitstream corresponding to at least one band encompassed by the expandedrange is decoded according to the read band indicator corresponding tothe band encompassed by the expanded range, so as to obtain at least oneband. The image file processing method may further comprise displayingthe portion of the image corresponding to the expanded range. Thedisplayed portion could be a portion of the image selected by theexpanded rage.

The band indicator may record a segment length of the correspondingsegment, or a segment starting position of the corresponding segment inthe bit stream. Relative addresses or absolute addresses of the bandindicators may be the same length of bits or follow a fixed format, soas to reduce the variety of decoding and accelerate the processing ofthe image file.

In addition, in order to enable the image file to be applicable toexisting decoders, every 8 consecutive bands are defined as a largeband, and every 8 corresponding consecutive segments are defined as alarge segment. Values of the RMs of the segments in each large segmentmay be sequentially 0xFFD0, 0xFFD1, 0xFFD2, 0xFFD3, 0xFFD4, 0xFFD5,0xFFD6, and 0xFFD7.

Based on the above, the image file processing method of the presentinvention can decode only the segment of the bit stream corresponding tothe band which is encompassed by the expanded range. Therefore, theimage file processing method of the present invention does not need todecode the entire image back into full resolution, thereby saving thememory capacity, the memory bandwidth accessing, and the operationresource during decoding. In the image file processing method of thepresent invention, the band indicators of the image file are stored inthe EXIF data, which is attached in the JPEG file, while the bit streampart still complies with JPEG specifications, and thus the image file iscompatible with existing JPEG decoders. Furthermore, as compared withthe conventional method, in the image file processing method of thepresent invention, the overhead caused by the band indicators added inthe EXIF data is quite small, so that the image file can have good datacompression ratio.

These and other aspects of the present invention will become apparentfrom the following description of the preferred embodiment taken inconjunction with the following drawings, although variations andmodifications therein may be affected without departing from the spiritand scope of the novel concepts of the disclosure.

BRIEF DESCRIPTION OF THE DRAWINGS

The accompanying drawings illustrate one or more embodiments of theinvention and, together with the written description, serve to explainthe principles of the invention. Wherever possible, the same referencenumbers are used throughout the drawings to refer to the same or likeelements of an embodiment, and wherein:

FIG. 1 is a schematic view of an image file according to an embodimentof the present invention;

FIG. 2 is a schematic view of an image according to an embodiment of thepresent invention;

FIG. 3 is a schematic view of a bit stream according to an embodiment ofthe present invention;

FIG. 4 is a schematic view of EXIF data according to an embodiment ofthe present invention;

FIG. 5 is a flow chart of an image file processing method according toan embodiment of the present invention; and

FIG. 6 is a schematic view of an expanded range according to anembodiment of the present invention.

DETAILED DESCRIPTION OF THE INVENTION

An image file processing method of the present invention is used fordecoding a portion of range in an image according to an expanded range(also referred to as a window of interest (WOI)), so as to display aportion of the image selected by the expanded range. The portion of theimage file refers to a part of a single image file.

FIG. 1 is a schematic view of an image file according to an embodimentof the present invention.

Referring to FIG. 1, an image file 20 comprises a bit stream 30 and EXIFdata 40. The image file 20 may be in a JPEG format; however, the presentinvention is not limited to the JPEG format, but encompasses any imagefile 20 that can achieve the objective.

FIG. 2 is a schematic view of an image according to an embodiment of thepresent invention, and FIG. 3 is a schematic view of a bit streamaccording to an embodiment of the present invention.

Referring to FIGS. 2 and 3, an image 50 is divided into a plurality ofconsecutive image blocks 56, and at least one row of the MCU 54sequentially define the image 50 as a plurality of bands 52. That is tosay, the bands 52 comprise at least one row of the MCU 54. For example,one or more image blocks 56 may be coded as MCU 54, and one row of theMCUs 54 sequentially define as the bands 52.

The image 50 may be represented as the YC_(b)C_(r) color space. Y,C_(b), and C_(r) of the YC_(b)C_(r) color space respectively representluminance, blue chrominance (also referred to as chroma), and redchrominance values of a pixel in the image 50. Each MCU 54 may berepresented by the YC_(b)C_(r) color space as at least one data unit.Many sampling methods are used for coding the image 50. For example, thesampling method of “4:2:0” means that one MCU 54 comprises 4 imageblocks 56, and one MCU 54 is represented by 6 data units of theluminance of the 4 image blocks 56, and one blue chrominance and one redchrominance between the image blocks 56.

The image 50 may be coded as bit stream 30 by Huffman coding scheme. Inthe JPEG image standard, each compressed data unit may be represented byone DC coefficient and 63 AC coefficients. The DC coefficient in the bitstream 30 may be non-differential form or differential form. Thedifferential image DC coefficient records a difference between the DCcoefficients of the current data unit and the previous data unit. Thenon-differential DC coefficient represents that the DC coefficient isthe original value without making the difference.

The bit stream 30 has a plurality of segments 32 individuallycorresponding to the bands 52 of the image 50, and the segments 32comprise all coded data units in the bands 52. The bit stream 30 alsohas a plurality of restart markers (RSTm or RM) 38 respectively locatedafter the segments 32 except the last segment, and values of the RMs 38may be 0xFFD0 to 0xFFD7 sequentially. Besides, the bit stream 30 has anend of file (EOF) located after the last segment, and the EOF may be0xFFD9.

Each segment 32 in the bit stream 30 has a non-differential DCcoefficient 39, that is, the non-differential DC coefficient 39 iscorresponding to the first image block 56 of the band 52 correspondingto the starting position of the segment 32. In detailed description, thenon-differential DC coefficient 39 is an image DC coefficient in thefirst MCU 54 of the band 52 corresponding to the segment 32.

In the JPEG specifications, each RM 38 is followed by thenon-differential DC coefficient 39, so that the image file 20 complieswith the JPEG specifications, and thus can be expanded by existingcommon JPEG decoders back into the full resolution image 50 in aconventional manner.

FIG. 4 is a schematic view of EXIF data according to an embodiment ofthe present invention. Referring to FIG. 4, the EXIF data 40 of theimage file 20 comprises a plurality of band indicators 42. The bandindicators 42 are individually corresponding to the bands 52, and eachband indicator 42 is used for indicating a position of the segment 32corresponding to the corresponding band 52 in the bit stream 30. Theband indicator 42 may record a segment length of the correspondingsegment 32, or a segment starting position of the corresponding segment32 in the bit stream 30. That is to say, the band indicators 42 canaddress the segment 32 of corresponding bands 52 by recording relativeaddresses or absolute addresses. The relative addresses or absoluteaddresses of all the band indicators 42 may be of the same length ofbits or follow a fixed format, so as to reduce the difficulty ofdecoding and accelerate the processing of the image file 20.

However, in the image file 20, the band indicators 42 may also addressthe segment 32 of corresponding bands 52 by using absolute addresses orrelative addresses in a mixed manner. As long as the relationshipbetween absolute addresses or relative addresses are following apredefined manner, such as fixed interleaving manner of absoluteaddresses and relative addresses, it can be known that the next bandindicator 42 uses an absolute address or a relative address. Therefore,the relative addresses or absolute addresses of the band indicators 42may also be of different lengths of bits, for example, the length of therelative addresses may be shorter than absolute addresses.

In addition, the EXIF data 40 may further comprise at least onecapturing parameter when the image 50 is captured. The capturingparameter may be a camera model, a focal length, an image capturing dayand time, an exposure time, an f-number, a photosensitivity, or ametering mode.

FIG. 5 is a flow chart of an image file processing method according toan embodiment of the present invention, and FIG. 6 is a schematic viewof an expanded range according to an embodiment of the presentinvention. The steps of processing the image file 20 by the image fileprocessing method of the present invention is described in detail withreference to FIGS. 5 and 6. The image file processing method can decodea portion of the bit stream 30 according to the expanded range 58, so asto obtain the portion of the image in the expanded range 58.

Firstly, the compressed image file 20 of the image 50 as described above(Step S100) and the selected expanded range 58 are provided. Theexpanded range 58 may be defined by the user, and the expanded range 58encompasses at least one band 52. Then, the band indicator 42corresponding to the band 52 is read from the EXIF data 40 according tothe expanded range 58 (Step S110). For example, in FIG. 6, the image 50comprises bands 52 a, 52 b, 52 c, and 52 d, and the expanded range 58encompasses the bands 52 b and 52 c. Therefore, in Step S110, the bandindicators 42 are read to obtain the positions of the segments 32corresponding to the bands 52 b and 52 c in the bit stream 30.

When the band indicators 42 record the segment starting positions of thecorresponding segments 32 in the bit stream 30, absolute positions ofthe segments 32 corresponding to the bands 52 b and 52 c in the bitstream 30 can be directly obtained by reading the band indicators 42corresponding to the bands 52 b and 52 c. When the band indicators 42record the segment lengths (being considered as relative positions ofthe corresponding segments 32 in the bit stream 30) of the correspondingsegments 32, all the band indicators 42 before the band indicator 42corresponding to the band 52 b also need to be read and then summed up,so as to obtain the absolute positions of the segments 32 correspondingto the bands 52 b and 52 c in the bit stream 30. That is to say, whichbit in the bit stream 30 is the starting bit of the segment 32 can beknown by the band indicator 42. Then, at least one segment 32 in the bitstream 30 corresponding to at least one band 52 is decoded according tothe read band indicator 42 and the band 52 encompassed by the expandedrange 58, so as to obtain the portion of the image of at least one band52 (Step S120).

The corresponding segment 32 can be found according to the bandindicator 42, and all segments 32 in the bit stream 30 before thesegment 32 corresponding to the expanded range 58 do not need to bedecoded during decoding in Step S120.

After the non-differential DC coefficient 39 at the starting position ofthe segment 32 corresponding to the expanded range 58 is obtained duringdecoding, the segment 32 corresponding to the expanded range 58 can bedecoded according to the non-differential DC coefficient 39. In theentire bit stream 30, only the segment 32 corresponding to the expandedrange 58 is decoded, so as to obtain the band 52 encompassed by theexpanded range 58. In addition, the image file processing method mayfurther comprise displaying the portion of the image corresponding tothe expanded range 58 in the decoded band 52. That is to say, only theportion of the image in the band 52 selected by the expanded range 58 isdisplayed for the user to review.

However, some existing decoders can only recognize the value of thefirst decoding RM 38 as 0xFFD0. In order to enable the image fileprocessing method to be applicable to existing decoders, every 8consecutive bands 52 are defined as a large band, and every 8corresponding consecutive segments 32 are defined as a large segment.Most preferably, values of the RMs 38 of the segments 32 in each largesegment may be sequentially 0xFFD0, 0xFFD1, 0xFFD2, 0xFFD3, 0xFFD4,0xFFD5, 0xFFD6, and 0xFFD7. As such, the use of large segment as unitscan avoid the problem that some inflexible decoders can only identifythe first decoding RM 38 having the value of 0xFFD0.

Based on the above, the image file processing method of the presentinvention reads the band indicators written in the EXIF data, and candecode only the segment of the bit stream corresponding to the bandencompassed by the expanded range. Therefore, the image file processingmethod of the present invention does not need to decode the entire imageback into full resolution, and thus can greatly save the memorycapacity, the memory bandwidth accessing, and the operation resourcerequired during decoding, thereby greatly reducing the time required fordecoding a portion of the image, and reducing the cost required for theimage processing. Moreover, in the image file processing method of thepresent invention, the image file writes the band indicators in the EXIFdata, which is attached in the JPEG file, while the bit stream partstill complies with the JPEG specifications. Therefore, the image fileprovided by the present invention is compatible with existing JPEGdecoders, thereby maintaining a high compatibility. Furthermore, ascompared with the conventional method, in the image file processingmethod of the present invention, the overhead caused by the bandindicators added in the EXIF data is quite small, so that the datacompression ratio of the image file can still be maintained.

What is claimed is:
 1. An image file processing method, comprising:providing an image file of an image by a processor, wherein the image isdivided into a plurality of image blocks, at least one row of the imageblocks are defined as bands, and the image file comprises: a bit stream,representing the image, wherein the bit stream has a plurality ofsegments individually corresponding to the bands, and a plurality ofrestart markers are respectively located after the segments except thelast segment; and exchangeable image file (EXIF) data, comprising aplurality of band indicators, wherein the band indicators areindividually corresponding to the bands, and each band indicator is usedfor indicating a position of the segment corresponding to thecorresponding band in the bit stream; reading at least one bandindicator according to an expanded range for selecting local blocks ofthe image by the processor; and decoding at least one segment in the bitstream corresponding to at least one band encompassed by the expandedrange according to the read band indicator corresponding to the bandencompassed by the expanded range by the processor, so as to obtain atleast one band.
 2. The image file processing method according to claim1, further comprising: displaying a portion of the image correspondingto the expanded range.
 3. The image file processing method according toclaim 1, wherein the band indicator records a segment length of thecorresponding segment.
 4. The image file processing method according toclaim 1, wherein the band indicator records a segment starting positionof the corresponding segment in the bit stream.
 5. The image fileprocessing method according to claim 1, wherein every 8 consecutivebands are defined as a large band, and every 8 corresponding consecutivesegments are defined as a large segment.
 6. The image file processingmethod according to claim 5, wherein values of the restart markers ofthe segments in each large segment are sequentially 0xFFD0, 0xFFD1,0×FFD2, 0×FFD3, 0×FFD4, 0×FFD5, 0×FFD6, and 0xFFD7.
 7. The image fileprocessing method according to claim 1, wherein the EXIF data furthercomprises at least one capturing parameter when the image is captured.8. The image file processing method according to claim 7, wherein thecapturing parameter is a camera model, a focal length, a capturing dayand time, an exposure time, an f-number, a photosensitivity, or ametering mode.
 9. The image file processing method according to claim 1,wherein relative addresses or absolute addresses of the band indicatorsare of the same length of bits.